;Assembler header file for Joystick
;written by DefMod (Dec 31 2005) on Sat Dec 31 14:01:38 2005
;Jonathan Coxhead, jonathan@doves.demon.co.uk, 18 May 1995

        [       :LNOT: :DEF: Joystick_Hdr
        GBLS    Joystick_Hdr

        [       :LNOT: :DEF: Get_Types
        GBLS    Get_Types
        ]
        [       :LNOT: :DEF: Types_Hdr
Get_Types                       SETS    "GET oslib/Types.Hdr"
        |
Get_Types                       SETS    ""
        ]
        $Get_Types

        [       :LNOT: :DEF: Get_OS
        GBLS    Get_OS
        ]
        [       :LNOT: :DEF: OS_Hdr
Get_OS                          SETS    "GET oslib/OS.Hdr"
        |
Get_OS                          SETS    ""
        ]
        $Get_OS

;Symbols for constants
Joystick_X                      *       &FF
Joystick_Y                      *       &FF00
Joystick_Switches               *       &FF0000
Joystick_XShift                 *       0
Joystick_YShift                 *       8
Joystick_SwitchesShift          *       16
Joystick_HalfWordX              *       &FFFF
Joystick_HalfWordY              *       &FFFF0000
Joystick_HalfWordXShift         *       0
Joystick_HalfWordYShift         *       16

;Symbols for structure offsets and sizes
                                ^       0
                                #       Bits
Joystick_State                  *       @

                                ^       0
                                #       Bits
Joystick_HalfWordState          *       @


;Symbols for SWI's and SWI reason codes
XJoystick_Read                  *       &63F40
Joystick_Read                   *       &43F40
   ;Entry
   ;  R0 = joystick_no (Int)
   ;Exit
   ;  R0 = state (Joystick_State)

XJoystick_ReadHalfWord          *       &63F40
Joystick_ReadHalfWord           *       &43F40
   ;Entry
   ;  R0 = &100 :OR: joystick_no (Int)
   ;Exit
   ;  R0 = state (Joystick_HalfWordState)
   ;  R1 = switches (Bits)

XJoystick_CalibrateTopRight     *       &63F41
Joystick_CalibrateTopRight      *       &43F41

XJoystick_CalibrateBottomLeft   *       &63F42
Joystick_CalibrateBottomLeft    *       &43F42

        ]
        END
